<template>
    <div class="mui-numbox" data-numbox-min='1'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="initcount" ref="count" @change="countChanged" readonly/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
    import mui from '../../../../dist/js/mui.min'
    export default {
        mounted() {
            // 初始化数字选择框组件
            mui(".mui-numbox").numbox();
        },
        methods:{
            countChanged(){
                // console.log(this.$refs.count.value);
                this.$store.commit('updateGoodsinfo',{id:this.goodsid,count:this.$refs.count.value})
            }
        },
        props:["initcount","goodsid"]
    }
</script>

<style scoped>
    .mui-numbox {
        height: 25px;
    }
</style>